package com.lirh.queue.rabbitmqcustom.config;


import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * amqp交换机配置
 */
@Configuration
public class DirectConfig {
    @Bean
    public Queue reportPaymentQueue(){
        return  new Queue("api.report.payment");
    }
    @Bean
    public Queue reportRefundQueue(){
        return new Queue("api.report.refund");
    }
    @Bean
    public FanoutExchange reportExchange(){
        return new FanoutExchange("reportExchange");
    }
    @Bean
    public Binding bindingReportRefundExchange(Queue reportRefundQueue,FanoutExchange reportExchange){
        return BindingBuilder.bind(reportRefundQueue).to(reportExchange);
    }
    @Bean
    public Binding bindingReportPaymentExchange(Queue reportPaymentQueue,FanoutExchange reportExchange){
        return BindingBuilder.bind(reportPaymentQueue).to(reportExchange);
    }

}
